#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using i128 = __int128;

struct ty {
    ll a, b, c;
} a[1010];

bool cmp(ty a, ty b) { return a.c < b.c; }

vector<int> itov(int n) {
    vector<int> res;
    if (n == 0) {
        res.push_back(0);
        return res;
    }
    while (n) {
        res.push_back(n % 10);
        n /= 10;
    }
    return res;
}

vector<int> maxx(vector<int> a, vector<int> b) {
    if (a.size() > b.size()) {
        return a;
    } else if (a.size() < b.size()) {
        return b;
        ;
    } else {
        for (int i = a.size() - 1; i >= 0; i--) {
            if (a[i] > b[i])
                return a;
            else if (a[i] < b[i])
                return b;
            else
                continue;
        }
    }
    return a;
}

vector<int> chen(vector<int> a, int b) {
    vector<int> res = a;
    int carry = 0;
    for (int i = 0; i < res.size(); i++) {
        int temp = res[i] * b + carry;
        res[i] = temp % 10;
        carry = temp / 10;
    }
    while (carry) {
        res.push_back(carry % 10);
        carry /= 10;
    }
    return res;
}

vector<int> chu(vector<int> a, int b) {
    vector<int> res;
    int temp = 0;
    bool lead0 = false;
    for (int i = a.size() - 1; i >= 0; i--) {
        temp = temp * 10 + a[i];
        res.push_back(temp / b);
        temp %= b;
    }
    while (res.size() > 1 && *res.begin() == 0) res.erase(res.begin());
    reverse(res.begin(),res.end());
    return res;
}

void solve() {
    ll n;
    cin >> n;
    cin >> a[0].a >> a[0].b;
    a[0].c = a[0].a * a[0].b;
    for (ll i = 1; i <= n; i++) {
        cin >> a[i].a >> a[i].b;
        a[i].c = a[i].a * a[i].b;
    }
    sort(a + 1, a + n + 1, cmp);
    vector<int> sum = itov(a[0].a);
    vector<int> ans = {0};
    for (ll i = 1; i <= n; i++) {
        ans = maxx(ans, chu(sum, a[i].b));
        sum = chen(sum, a[i].a);
    }
    for (int i = ans.size() - 1; i >= 0; i--) {
        cout << ans[i];
    }
    cout << endl;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    solve();
    return 0;
}